Skip to content

Add Donation Amount Validation from EN for static and frequency-based validation - #342

Merged
fernanDOTdo merged 1 commit into
mainfrom
min-donation
Aug 19, 2025
Merged

Add Donation Amount Validation from EN for static and frequency-based validation#342
fernanDOTdo merged 1 commit into
mainfrom
min-donation

Conversation

@MichaelT372

Copy link
Copy Markdown
Contributor

This feature expands the MinMaxAmount to allow for Min Amount, Max Amount and Error Messages to be provided to ENgrid directly from a Engaging Networks validator. This allows the client to change validators for their donation amount per page using EN validators instead of changing the ENgrid Options.

It also adds support for Engaging Network's new Donation Frequency based Donation Amount Validator.

All of this is added behind the feature flag UseAmountValidatorFromEN which has been set to false by default. Before deploying to clients, I advise checking they do not have any malfunctioning validators set - but this is unlikely since they would be causing a server-side error if they did.

The component searches the validators defined in window.EngagingNetworks.validators for one that is an AMNT (static amount) or FAMNT (frequency based amount) type and is also attached to the same component that we know to be the Donation Amount Input. Then, it either alters the MinMaxAmount configuration (if static) or sets up a Frequency Change listener to alter the configuration whenever the frequency changes. Logging has been added for when changes happen.

Demo pages have been set up using this branch built on a branch of TNC's client theme https://github.com/4site-interactive-studios/engrid-tnc/tree/min-donation

Static donation amount - ENgrid has 5-50,000 and the page overrides it to 25-50,000 - https://preserve.nature.org/page/176342/donate/1?assets=min-donation&debug=log

Frequency based - there are different ranges for single, monthly, quarterly and annual (EN's validator does not support semi-annual) - https://preserve.nature.org/page/176334/donate/1?assets=min-donation&debug=log

@fernanDOTdo fernanDOTdo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is amazing!

@fernanDOTdo
fernanDOTdo merged commit 396a96d into main Aug 19, 2025
2 checks passed
@fernanDOTdo
fernanDOTdo deleted the min-donation branch August 19, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants